import { handleActions } from 'redux-actions'

interface userInfo {
  amount?: number,
  areaCode?: string,
  crowdAmount?: any,
  headUrl?: string,
  idNo?: any,
  lftid?: number,
  nickname?: string,
  parentProxyId?: any,
  reAmount?: any,
  realname?: string,
  sex?: number,
  token?: string,
  uid?: string
}

interface userFinanceInfo {
  amount?: number,
  areaCode?: string,
  createTime?: number,
  crowdAmount?: number,
  isFreeze?: 0,
  remark?: string,
  uid?: string,
  updateTime?: number
}

interface appData {
  userInfo: userInfo,
  userFinanceInfo: userFinanceInfo,
  agentLevel: string
}
const appState: appData = {
  userInfo: {},
  userFinanceInfo: {},
  agentLevel: ''
}
const appReducer = handleActions({
  'saveUserInfo'(state, action) {
    console.log('loadUserInfo!', action);
    return { ...state, ...action.payload }
  }
}, appState)

export default appReducer